//
//  FSCTableViewCell.swift
//  FamiliesSchoolConnection
//
//  Created by 花花蔡 on 2016/12/28.
//  Copyright © 2016年 com.HuaHuaCai. All rights reserved.
//

import UIKit

class FSCTableViewCell: UITableViewCell {

    @IBOutlet weak var homeworkImageV: UIImageView!
    
    @IBOutlet weak var homeworkTitleL: UILabel!
    
    @IBOutlet weak var objectBtn: UIButton!
    
    @IBOutlet weak var teacherNameL: UILabel!
    
    @IBOutlet weak var timeL: UILabel!
    
    var model:FSCHomeworkModel? {
       
        didSet{
            guard let model = model else {
                return
            }
            //0为已经提交
            if model.subStatus == 0 {
                if model.checkStatus == 1 {
                    homeworkImageV.image = UIImage(named: "未批改")
                }else {
                    homeworkImageV.image = UIImage(named: "hw_base_responses")
                }

            }else {
                homeworkImageV.image = UIImage(named: "hw_base_no_commit")
            }
            homeworkTitleL.text = model.hw_title
            objectBtn.setTitle(model.courseName, for: .normal)
            teacherNameL.text = model.hw_tName
            timeL.text = model.hw_createDate
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()

        setupUI()
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    
    func setupUI() -> Void {
        objectBtn.layer.cornerRadius = 5
        objectBtn.layer.borderWidth = 1
        objectBtn.layer.borderColor = UIColor.colorWithHex(hexColor:blueColor).cgColor
        objectBtn.setTitleColor(UIColor.colorWithHex(hexColor: blueColor), for: .normal)
//        homeworkImageV.layer.cornerRadius = 30
//        homeworkImageV.layer.masksToBounds = true
    }
}


